package com.tradeplus.admin.dao;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;

import com.tradeplus.admin.model.Industry;

public class IndustryDaoImpl implements IndustryDao {
	
	private HibernateTemplate hibernateTemplate;

    public void setHibernateTemplate(HibernateTemplate hibernateTemplate) {
        this.hibernateTemplate = hibernateTemplate;
    }

	@Override
	public void saveIndustry(Industry industry) {
		hibernateTemplate.merge(industry);
	}

	@Override
	public List<Industry> loadIndustry() {
		return hibernateTemplate.find("from Industry");
	}

	@Override
	public Industry loadIndustryById(Long industryId) {
		return hibernateTemplate.get(Industry.class, industryId);
	}

	@Override
	public void deleteIndustry(Long industryId) {
		hibernateTemplate.delete(hibernateTemplate.get(Industry.class, industryId));
	}

}
